#include <bits/stdc++.h>
using namespace std;

const int N = 3e5+7;
int x;
vector <int>v[N];
int dfs(int prev, int cur) {
    int cnt=0;
  for (auto i:v[prev]) {
        if (i != cur) cnt += dfs(i,prev);
    }
    return cnt+1;
}

int main() {
    int n; cin >> n;
    for (int i=1; i<n; i++) {
        int u, w; cin >> u >> w;
        v[u].push_back(w);
        v[w].push_back(u);
    }
  for (auto i:v[1]){
        x = max(x, dfs(i,1));
    }
    cout << n-x << endl;

    return 0;
}
